-
Notifications
You must be signed in to change notification settings - Fork 74
MLE-26654 Renaming of the retry-on-status-code feature #1887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Copyright Validation Results ✅ Valid Files
✅ All files have valid copyright headers! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the retry-on-status-code feature in the OkHttpServices class to improve code clarity for developers. The changes rename variables and convert a mutable Set to an immutable constant, making the retry logic more explicit and maintainable.
Changes:
- Renamed retry-related variables to more descriptive names (e.g.,
randRetry→randomForRetryDelay,minRetry→minRetryAttempts,maxDelay→maxDelayForRetries) - Converted
retryStatusSet from a mutable field initialized in constructor to an immutable constantRETRYABLE_STATUS_CODES - Updated all references to use the new variable names throughout the class
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| private int minRetryAttempts = DEFAULT_MIN_RETRY; | ||
|
|
||
| // The HTTP status codes that are retryable. | ||
| private final Set<Integer> RETRYABLE_STATUS_CODES = |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The field RETRYABLE_STATUS_CODES should follow Java naming conventions for constants. It should be declared as static since it's initialized with immutable values and doesn't depend on instance state. Consider renaming to RETRYABLE_STATUS_CODES and making it private static final.
| private final Set<Integer> RETRYABLE_STATUS_CODES = | |
| private static final Set<Integer> RETRYABLE_STATUS_CODES = |
| } | ||
|
|
||
| private int calculateDelay(Random rand, int i) { | ||
| private int calculateDelay(int i) { |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter name i is ambiguous. Consider renaming it to retryAttempt or attemptNumber to clarify that it represents the current retry iteration.
This is currently an implementation detail and not exposed to a user, but doing some renaming here so it's easier for other developers to understand.
06bbf91 to
0d95e8c
Compare
This is currently an implementation detail and not exposed to a user, but doing some renaming here so it's easier for other developers to understand.